using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration; using Sispe.Entities;

namespace Sispe.Repository.Mapping
{
    public class TREGISTROMap : EntityTypeConfiguration<TREGISTRO>
    {
        public TREGISTROMap()
        {
            // Primary Key
            this.HasKey(t => t.IdTRegistro);

            // Properties
            this.Property(t => t.IdAFP)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.NombreAFP)
                .IsRequired()
                .HasMaxLength(350);

            // Table & Column Mappings
            this.ToTable("TREGISTRO");
            this.Property(t => t.IdTRegistro).HasColumnName("IdTRegistro");
            this.Property(t => t.IdContrato).HasColumnName("IdContrato");
            this.Property(t => t.IdAFP).HasColumnName("IdAFP");
            this.Property(t => t.NombreAFP).HasColumnName("NombreAFP");

            // Relationships
            this.HasRequired(t => t.CONTRATO)
                .WithMany(t => t.TREGISTROes)
                .HasForeignKey(d => d.IdContrato);

        }
    }
}
